<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>osciln</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="oscilikts.html" title="oscilikts" />
    <link rel="next" href="oscils.html" title="oscils" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">osciln</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="oscilikts.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="oscils.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="osciln"></a>
      <div class="titlepage"></div>
      <a id="IndexOsciln" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">osciln</span>
        </h2>
        <p>osciln — 
      Accesses table values at a user-defined frequency.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp129512032"></a>
        <h2>Description</h2>
        <p>
      Accesses table values at a user-defined frequency. This opcode can also be written as <a class="link" href="oscilx.html" title="oscilx"><em class="citetitle">oscilx</em></a>.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp129583760"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">ares <span class="command"><strong>osciln</strong></span> kamp, ifrq, ifn, itimes</pre>
      </div>
      <div class="refsect1">
        <a id="idp129585984"></a>
        <h2>Initialization</h2>
        <p>
      <span class="emphasis"><em>ifrq, itimes</em></span> -- rate and number of times through the stored table.
    </p>
        <p>
      <span class="emphasis"><em>ifn</em></span> -- function table number. 
    </p>
      </div>
      <div class="refsect1">
        <a id="idp129588480"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>kamp</em></span> -- amplitude factor
    </p>
        <p>
      <span class="emphasis"><em>osciln</em></span> will sample several times through the stored table at a rate of <span class="emphasis"><em>ifrq</em></span> times per second, after which it will output zeros. Generates audio signals only, with output values scaled by <span class="emphasis"><em>kamp.</em></span>
    </p>
      </div>
      <div class="refsect1">
        <a id="idp129591968"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the osciln opcode. It uses the file <a class="ulink" href="examples/osciln.csd" target="_top"><em class="citetitle">osciln.csd</em></a>.
      </p>
        <div class="example">
          <a id="idp129593824"></a>
          <p class="title">
            <strong>Example 567. Example of the osciln opcode.</strong>
          </p>
          <div class="example-contents">
            <p>See the sections <a class="link" href="UsingRealTime.html" title="Real-Time Audio"><em class="citetitle">Real-time Audio</em></a> and <a class="link" href="CommandFlags.html" title="Csound command line"><em class="citetitle">Command Line Flags</em></a> for more information on using command line flags.</p>
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
-odac   <span class="comment">;;;realtime audio out</span>
<span class="comment">;-iadc    ;;;uncomment -iadc if realtime audio input is needed too</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o osciln.wav -W ;;; for file output any platform</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="ohdr">sr</span> <span class="op">=</span> 44100
<span class="ohdr">ksmps</span> <span class="op">=</span> 32
<span class="ohdr">nchnls</span> <span class="op">=</span> 2
<span class="ohdr">0dbfs</span>  <span class="op">=</span> 1

gione <span class="ohdr">ftgen</span> 1, 0, 1024, 7, 0, 1,   1, 1024, 0
gitwo <span class="ohdr">ftgen</span> 2, 0, 1024, 7, 0, 512, 1, 512,  0

<span class="oblock">instr</span> 1	<span class="comment">;very simple waveguide system</span>

ifn     <span class="op">=</span> p4
ipitch  <span class="op">=</span> p5
itimes  <span class="op">=</span> p6
iperiod <span class="op">=</span> 1000<span class="op">/</span>ipitch

afeed   <span class="opc">init</span>   0
aimpl   <span class="opc">osciln</span> 1, ipitch, ifn, itimes   <span class="comment">;use as excitation signal</span>
arefl   <span class="opc">tone</span>   aimpl <span class="op">+</span> afeed, 4000
aout    <span class="opc">atone</span>  arefl, 5000
afeed   <span class="opc">vdelay</span> arefl, iperiod, 10
        <span class="opc">outs</span>   aout<span class="op">*</span>3, aout<span class="op">*</span>3
          
<span class="oblock">endin</span>
<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>

<span class="stamnt">i</span> 1 0  4 1 110 1	<span class="comment">;use different tables,</span>
<span class="stamnt">i</span> 1 5  4 2 110 1	<span class="comment">;&amp; different pitch</span>
<span class="stamnt">i</span> 1 10 4 1 110 10	<span class="comment">;&amp; different number of times the table is read</span>
<span class="stamnt">i</span> 1 15 4 2 110 10
<span class="stamnt">i</span> 1 20 6 1 880 1	
<span class="stamnt">i</span> 1 25 3 2 880 1
<span class="stamnt">i</span> 1 30 3 1 880 10
<span class="stamnt">i</span> 1 35 3 2 880 10

<span class="stamnt">e</span>
<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
    </p>
      </div>
      <div class="refsect1">
        <a id="idp129598112"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="table.html" title="table"><em class="citetitle">table</em></a>,
      <a class="link" href="tablei.html" title="tablei"><em class="citetitle">tablei</em></a>,
      <a class="link" href="table3.html" title="table3"><em class="citetitle">table3</em></a>,
      <a class="link" href="oscil1.html" title="oscil1"><em class="citetitle">oscil1</em></a>,
      <a class="link" href="oscil1i.html" title="oscil1i"><em class="citetitle">oscil1i</em></a>
    </p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="oscilikts.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="OpcodesTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="oscils.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">oscilikts </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> oscils</td>
        </tr>
      </table>
    </div>
  </body>
</html>
